<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE HTML >
<html>
<head>
    <title>风趣尔科技后台管理系统--登录</title>
    <jsp:include page="/WEB-INF/pages/commons/inc.jsp"></jsp:include>
    <style type="text/css">
        img {
            cursor: pointer;
        }
    </style>
    <script type="text/javascript">
        $(function() {
            $('#user_login_loginDialog').show().dialog({
                modal : true,
                title : '管理员登录',
                closable : false,
                buttons : [{
                    text : '登&nbsp;&nbsp;&nbsp;&nbsp;录',
                    handler : function() {
                        //检查用户名和密码是否输入完整
                        if($("#name").val()==null||$("#name").val()==""||$("#pwd").val()==null||$("#pwd").val()==""){
                            $.messager.show({
                                title : '管理员登录提示',
                                msg : "<span style='color: red'>用户名或者密码不能为空！</span>"
                            });
                            return;
                        }

                        $.ajax({
                            cache: true,
                            type: "POST",
                            url:$('#user_login_loginInputForm').attr("action"),
                            data:$('#user_login_loginInputForm').serialize(),
                            async: false,
                            error: function(request) {
                                alert("系统连接异常，请联系管理员！");
                            },
                            success: function(data) {
                                var r = $.parseJSON(data);
                                if (r.success) {
                                    location.replace('${pageContext.request.contextPath}/commons/index.action');
                                }else{
                                    $.messager.show({
                                        title : '提示',
                                        msg : "<span style='color: red'>"+r.msg+"</span>"
                                    });
                                }
                            }
                        });
                    }
                } ]
            });
        });
    </script>
</head>
<body>
<div id="user_login_loginDialog" style="display: none;width: 300px;height: 210px;overflow: hidden;">
    <div id="user_login_loginTab">
        <div title="输入方式" style="overflow: hidden;">
            <div>
                <div class="info">
                    <div class="tip icon-tip"></div>
                    <div>请输入用户名密码登录后台信息管理系统</div>
                </div>
            </div>
            <div align="center">
                <form method="post" id="user_login_loginInputForm" action="${pageContext.request.contextPath}/userController/login.action">
                    <table class="tableForm">
                        <tr>
                            <th>登录名</th>
                            <td><input name="name" id="name" class="easyui-validatebox" data-options="required:true" />
                            </td>
                        </tr>
                        <tr>
                            <th>密码</th>
                            <td><input type="password" id="pwd" name="pwd" class="easyui-validatebox" data-options="required:true" style="width: 150px;"  /></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
</html>
